package com.turing.pre.processor.enums;

import lombok.Getter;

/**
 * @author livin
 * @version V1.0
 * @date 2021/4/15 11:30
 * @copyright © 2020 Shenzhen Turing robot Co., Ltd
 */
public enum PreProcessorStatusEnum {

    /**
     * 文件下载
     */
    DOWNLOADED(0, "file downloaded"),

    /**
     * 等待文件到pdf
     */
    WAITINGFILE2PDF(1, "waiting file to pdf"),

    /**
     * 文件到pdf处理
     */
    FILE2PDFROCESSSING(2, "file to pdf processing"),

    /**
     * 等待PDF转换成JPG
     */
    WAITINGPDF2JPG(3, "waiting pdf to jpg"),

    /**
     * pdf到jpg处理
     */
    WAITINGPHOTO2JPG(4, "pdf to jpg processing"),

    /**
     * pdf到jpg完成
     */
    PDF2JPGFINISHED(5, "pdf to jpg finished"),

    /**
     * pdf到jpg的处理
     */
    PHOTO2JPGPROCESSING(6, "pdf to jpg processing"),

    /**
     * 图片转换成JPG格式完成
     */
    PHOTO2JPGFINISHED(7,"photo to jpg finished"),

    /**
     * 错误
     */
    ERROR(8, "error");

    @Getter
    private Integer code;

    @Getter
    private String name;

    PreProcessorStatusEnum(Integer code, String name) {

        this.code = code;
        this.name = name;

    }

    public static PreProcessorStatusEnum getEnum(Integer index) {

        PreProcessorStatusEnum[] statusEnums = PreProcessorStatusEnum.values();
        for (PreProcessorStatusEnum anStatusEnum : statusEnums) {
            if (index.equals(anStatusEnum.getCode())) {
                return anStatusEnum;
            }
        }
        return null;

    }

}
